<?

//-----------------------------------------------------------------------------
/**
* Html helper
*
*//**
* init the content of drop down 
*
* @param  array   $thisList     the array of content
* @param  string  $thisVar      the current selected 
* @param  array   $retContent
*
*/
function initDropDownContent(&$thisList,
                             $thisVar,
                             &$retContent){
  
  $thisOptList  =	"";
  
  foreach($thisList as $list){
  	
  	if($thisVar == $list){
  		
  		$selme = "selected";
  	}else{
  		
  		$selme = "";
  	}
  	
  	$thisOptList .= "\n <OPTION VALUE='$list' $selme >$list \n ";
  }
  
  unset($list);
  
  $retContent = $thisOptList;

}

/**
* the drop down form
*
* @param    string  $varName    this form name
* @param    string  $stdPrp     properties of this form
* @param    array   $thisList   the array of content
* @param    string  $thisVar    the current selected 
* @return   string 
*
*/
function formDropDown($varName,
                      $thisVar,
                      $thisList,
                      $stdPrp){
  
  $thePrp = &$stdPrp;
  
  initDropDownContent($thisList,
      		            $thisVar,
      		            $optList);
      		            
  return " <select name='".$varName."' ".$thePrp.">	".$optList." </select> ";
}

/**
* Input box type text
*
* @param    string  $varName    this form name
* @param    string  $varValue   the value
* @param    string  $stdPrp     properties of this form
* @return   string
*
*/
function formInput($varName,
                   $varValue,
                   $thePrp){
  
  return " <input type='text' name='".$varName."' value='".$varValue."' ".$thePrp."> ";
}

/**
* Input box type hidden
*
* @param    string  $varName    this form name
* @param    string  $varValue   the value
* @param    string  $stdPrp     properties of this form
* @return   string
*
*/
function formHidden($varName,
                    $varValue){
  
  return " <input type='hidden' name='".$varName."' value='".$varValue."'> ";
}

/**
* Input check box
*
* @param    string    $varName  this form name
* @param    string    $varValue  
* @param    string    $stdPrp   properties of this form
* @return   string
*
*/
function formCheckBox($varName,
                      $varValue,
                      $thePrp){
                        
  return " <input type='checkbox' name='".$varName."' value='".$varValue."' ".$thePrp."> ";
}

/**
* Input button
*
* @param    string    $varLabel this button label
* @param    string    $varName  this form name
* @param    string    $varValue  
* @param    string    $stdPrp   properties of this form
* @return   string
*
*/
function formInputButton($varLabel,
                         $varName,
                         $varValue,
                         $thePrp){
                          
  return " <button type='submit' name='".$varName."' value='".$varValue."' ".$thePrp."> ".$varLabel." </button> ";
}
?>